home *** CD-ROM | disk | FTP | other *** search
Text File | 1996-04-25 | 5.4 KB | 238 lines | [TEXT/MPS ] |
- //========================================================================================
- //
- // File: FWPrInfo.h
- // Release Version: $ ODF 1 $
- //
- // Copyright: (c) 1993 - 1996 by Apple Computer, Inc., all rights reserved.
- //
- //========================================================================================
-
- #ifndef FWPRINFO_H
- #define FWPRINFO_H
-
- // ----- Foundation Includes -----
-
- #ifndef FWSTDDEF_H
- #include "FWStdDef.h"
- #endif
-
- #ifndef FWEXCLIB_H
- #include "FWExcLib.h"
- #endif
-
- // ----- OS Includes -----
-
- #ifndef FWGXCFG_H
- #include "FWGXCfg.h"
- #endif
-
- #ifndef FWRECT_H
- #include "FWRect.h"
- #endif
-
- // ----- OpenDoc Includes -----
-
- #ifndef FWODTYPS_H
- #include "FWODTyps.h"
- #endif
-
- #ifndef SOM_ODTransform_xh
- #include <Trnsform.xh>
- #endif
-
- // ----- Platform -----
-
- #if defined(FW_BUILD_MAC) && !defined(__PRINTING__)
- #include <Printing.h>
- #endif
-
- #if defined(FW_SUPPORT_GX) && !defined(__GXTYPES__)
- #include <GXTypes.h>
- #endif
-
- #if defined(FW_SUPPORT_GX) && !defined(__GXPRINTING__)
- #include <GXPrinting.h>
- #endif
-
- #if defined(FW_SUPPORT_GX) && !defined(__GXENVIRONMENT__)
- #include <GXEnvironment.h>
- #endif
-
- //========================================================================================
- // Forward class definitions
- //========================================================================================
-
- class FW_CString;
- class FW_CPrintHandler;
-
- class ODSession;
- class ODStorageUnit;
- class ODFrame;
- class ODFacet;
- class ODCanvas;
-
- //========================================================================================
- // class FW_CPrintEnvironment
- //========================================================================================
-
- class FW_CPrintEnvironment
- {
- public:
- FW_DECLARE_AUTO(FW_CPrintEnvironment)
-
- FW_CPrintEnvironment();
- virtual ~FW_CPrintEnvironment();
-
- #ifdef FW_BUILD_MAC
- void MacRestoreResFile();
- #endif
-
- // ------ Implementation
- private:
- #ifdef FW_BUILD_MAC
- GrafPtr fOldPort;
- short fMacResFile;
- #endif
- };
-
- //========================================================================================
- // class FW_CPrintInfo
- //========================================================================================
-
- class FW_CPrintInfo
- {
- public:
- FW_DECLARE_AUTO(FW_CPrintInfo)
-
- FW_CPrintInfo(
- Environment* ev,
- ODStorageUnit* storageUnit,
- FW_CPrintEnvironment* printEnv);
- // Attempts to initialize from the storage unit; if
- // there is no print into there, uses default values
-
- virtual ~FW_CPrintInfo();
-
- // ----- Print info
- void GetCopyCount(short& copyCount, FW_Boolean& collate) const;
- void GetPages(long& firstPage, long& lastPage);
- FW_CRect GetPageBounds() const;
-
- void SaveToStorageUnit(Environment* ev, ODStorageUnit* storageUnit) const;
-
- #ifdef FW_BUILD_WIN
- LPPRINTDLG WinGetPrintDlg();
- void WinUpdatePageRect();
- #endif
- #ifdef FW_BUILD_MAC
- THPrint MacGetTHPrint() const;
- #endif
- #ifdef FW_SUPPORT_GX
- gxJob GetGXJob() const;
- #endif
-
- // ------ Implementation
- protected:
- #ifdef FW_BUILD_WIN
- PRINTDLG fWinPrintDlg;
- RECT fWinPageBounds;
-
- void WinSetPrintDlgToDefaults();
- #endif
- #ifdef FW_BUILD_MAC
- THPrint fMacPrintRec;
- #endif
- #ifdef FW_SUPPORT_GX
- gxJob fGXJob;
- static gxJob LoadFromStorageUnitGX(
- Environment* ev,
- ODStorageUnit* storageUnit);
- #endif
- };
-
- //========================================================================================
- // class FW_CPrintJob
- //========================================================================================
-
- class FW_CPrintJob
- {
- public:
- FW_DECLARE_AUTO(FW_CPrintJob)
-
- FW_CPrintJob(
- FW_CPrintInfo* printInfo,
- FW_CPrintHandler* printHandler,
- FW_CPrintEnvironment* printEnv);
- virtual ~FW_CPrintJob();
-
- virtual ODFacet* OpenDocument(
- Environment* ev,
- ODFrame* frame,
- ODSession* session,
- long numPages,
- const FW_CString& title);
-
- virtual void CloseDocument(
- Environment* ev,
- ODFacet* facet);
-
- virtual void CloseDocumentOnError(
- Environment* ev,
- ODFacet* facet);
-
- virtual void OpenPage(long pageNumber);
- virtual void ClosePage();
- virtual void ClosePageOnError();
-
- virtual void FinishPrinting();
-
- // ------ Implementation
- protected:
- FW_CPrintInfo* fPrintInfo;
- FW_CPrintHandler* fPrintHandler;
- FW_CPrintEnvironment* fPrintEnv;
-
- void PrivCreatePlatformPrintJob(long numPages, const FW_CString& title);
- ODCanvas* PrivCreatePrintCanvas(Environment* ev, ODFacet* facet);
-
- void PrivAbortPlatformPrintJob();
-
- #ifdef FW_SUPPORT_GX
- gxViewPort fGXViewPort;
- gxShapeSpoolUPP fGXSpoolUPP;
- WindowPtr fMacCanvasWindow;
-
- #endif
- #ifdef FW_BUILD_WIN
- int fWinSaveDCIndex;
- #endif
- #ifdef FW_BUILD_MAC
- TPrPort* fMacPrPort;
- #endif
-
- void DoCloseDocument(
- Environment* ev,
- ODFacet* facet,
- FW_Boolean checkErrors);
-
- void DoClosePage(
- FW_Boolean checkErrors);
- };
-
- //========================================================================================
- // class FW_XPrint
- //========================================================================================
-
- struct FW_XPrint
- {
- static void CheckPrintError(FW_PlatformError error);
- #ifdef FW_SUPPORT_GX
- static void CheckGXJobError(gxJob job);
- #endif
- #ifdef FW_BUILD_MAC
- static void MacCheckPrintError();
- #endif
- };
-
- #endif // FWPRINFO_H
-